<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sugar</title>
</head>

<body>
  <script>

    const obj = { username: 123 }

    // 获取对象的所有键名称
    const res = Object.keys(obj);
    // 获取对象所有的值
    const res2 = Object.values(obj);
    console.log(obj);
    console.log(res);
    console.log(res2);

  </script>
</body>

</html>